package be.darling.scrt.data;

import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: geert
 * Date: Nov 20, 2007
 * Time: 9:33:59 PM
 * To change this template use File | Settings | File Templates.
 */
public class Condition implements Comparable{
    

    String name;
    HashMap<String, String> properties;

    public Condition(String name)
    {
        this(name, new HashMap<String, String>());
    }

    public Condition(String name, HashMap<String, String> properties) {
        this.name = name;
        this.properties = properties;
    }


    public String getName() {
        return name;
    }

    public String getProperty(String key) {
        return properties.get(key);
    }

    public String toString() {
        return name;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Condition label = (Condition) o;

        if (name != null ? !name.equals(label.name) : label.name != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (name != null ? name.hashCode() : 0);
        //result = 31 * result + (description != null ? description.hashCode() : 0);
        return result;
    }

    public int compareTo(Object o) {
        // check on object type?
        return name.compareTo(((Condition)o).getName());  //To change body of implemented methods use File | Settings | File Templates.
    }
}
